// 基于template/src/widgets/\{{appEntities}}/\{{ctrls@GRID}}-grid/\{{spinalCase ctrl.codeName}}-grid-vo.ts.hbs生成
import { ControlVOBase } from '@/core';

export class GridDataControlVO extends ControlVOBase {

    constructor(data: any){
        super(data);
        const wfKey = ['srftaskid','srftaskdefinitionkey','srfprocessdefinitionkey','srfprocessdefinitionid','srfprocessinstanceid'];
        //  表格自持属性
        this.$ownKeys = ['{{lowerCase ctrl.psAppDataEntity.codeName}}', {{#each ctrl.psDEGridDataItems as | dataItem |}}'{{lowerCase dataItem.name}}', {{/each}}...wfKey];
    }

    {{#each ctrl.psDEGridDataItems as | dataItem |}}
    {{#if dataItem.psAppDEField}}
    get {{lowerCase dataItem.name}}() {
        return this.$DO.{{lowerCase dataItem.psAppDEField.codeName}};
    }

    set {{lowerCase dataItem.name}}(value: any) {
        this.$DO.{{lowerCase dataItem.psAppDEField.codeName}} = value;
    }
    {{/if}}
    {{/each}}

    set {{lowerCase ctrl.psAppDataEntity.codeName}}(value: any) {
        this.$DO.{{lowerCase ctrl.psAppDataEntity.keyPSAppDEField.codeName}} = value;
    }
    get {{lowerCase ctrl.psAppDataEntity.codeName}}() {
        return this.$DO.{{lowerCase ctrl.psAppDataEntity.keyPSAppDEField.codeName}};
    }

    get srftaskid(){
        return this.$DO.srftaskid;
    }

    get srftaskdefinitionkey(){
        return this.$DO.srftaskdefinitionkey;
    }

    get srfprocessdefinitionkey(){
        return this.$DO.srfprocessdefinitionkey;
    }

    get srfprocessdefinitionid(){
        return this.$DO.srfprocessdefinitionid;
    }

    get srfprocessinstanceid(){
        return this.$DO.srfprocessinstanceid;
    }
}

{{#if ctrl.psDEDataExport}}
export class GridExportControlVO extends ControlVOBase {

    constructor(data: any){
        super(data);
        const wfKey = ['srftaskid','srftaskdefinitionkey','srfprocessdefinitionkey','srfprocessdefinitionid','srfprocessinstanceid'];
        //  表格自持属性
        this.$ownKeys = ['{{lowerCase ctrl.psAppDataEntity.codeName}}', {{#each ctrl.psDEDataExport.psDEDataExportItems as | item |}}{{#if item.psAppDEField}}'{{lowerCase item.psAppDEField.codeName}}'{{/if}}{{#unless @last}}, {{/unless}}{{/each}}, ...wfKey];
    }

    {{#each ctrl.psDEDataExport.psDEDataExportItems as | item |}}
    {{#if item.psAppDEField}}
    get {{lowerCase item.name}}() {
        return this.$DO.{{lowerCase item.psAppDEField.codeName}};
    }

    set {{lowerCase item.name}}(value: any) {
        this.$DO.{{lowerCase item.psAppDEField.codeName}} = value;
    }
    {{/if}}
    {{/each}}

    set {{lowerCase ctrl.psAppDataEntity.codeName}}(value: any) {
        this.$DO.{{lowerCase ctrl.psAppDataEntity.keyPSAppDEField.codeName}} = value;
    }
    get {{lowerCase ctrl.psAppDataEntity.codeName}}() {
        return this.$DO.{{lowerCase ctrl.psAppDataEntity.keyPSAppDEField.codeName}};
    }

    get srftaskid(){
        return this.$DO.srftaskid;
    }

    get srftaskdefinitionkey(){
        return this.$DO.srftaskdefinitionkey;
    }

    get srfprocessdefinitionkey(){
        return this.$DO.srfprocessdefinitionkey;
    }

    get srfprocessdefinitionid(){
        return this.$DO.srfprocessdefinitionid;
    }

    get srfprocessinstanceid(){
        return this.$DO.srfprocessinstanceid;
    }
}
{{/if}}
export const {{pascalCase ctrl.name}}ControlVO = [{ name: 'GridControlVO', controlVO: GridDataControlVO }{{#if ctrl.psDEDataExport}}, { name: 'GridExportControlVO', controlVO: GridExportControlVO }{{/if}}]